package
{
import com.societyGames.robotExercises.RobotCodeExercise;

public class OutputRobotHomePosition extends RobotCodeExercise
{
  private var _hadValidOutput:Boolean = false;

  public function OutputRobotHomePosition()
  {
    var func:Function;
    func = getHomeX;
    func = getHomeY;
  }

  //ICodeExercise-->
  override protected function evaluateWithExceptionsHandled():void
  {
    if (this._hadValidOutput)
    {
      this.reportSuccess();
    }
    else
    {
      this.reportFailure();
    }
  }

  public override function queueOutput(...arguments):void
  {
    super.queueOutput.apply(this, arguments);
    this._hadValidOutput =
            arguments[0] is int
                    && arguments[1] is int
                    && arguments[0] == this.simulation.homePosition.x
                    && arguments[1] == this.simulation.homePosition.y;
  }

  //<--ICodeExercise
}
}